Description of the float type in PHP. The float type can be represented by the following code :? Php $ a1.234; $ b1.2e3; $ c7E-10 ;? Note the following when using the float type of PHP: the float type of PHP precision float can be expressed as
In the project, the float type is used to define some columns, such as price, but many problems are found.1. When the number of bits on the value is greater than 6, the float type is converted to the varchar type, which is displayed in the
Let's talk about the binary algorithm in the computer:
IntegerWe should be familiar with the binary algorithm of integers, that is, dividing them by two to get the remainder, and then sorting the remainder in reverse order. For example, calculate
PHP format the float type returned by MYSQL, and phpmysql returns float. PHP: format MYSQL to return the float type. phpmysql returns the float type. this example describes how to format MYSQL to return the float type. For your reference, the
I don't think many of my friends will use the float type in mysql, especially when we use money, we may use double precision, we know that the float type of mysql is a single-precision floating point type, which may cause data errors accidentally.
I
When using the float type of PHP, you must note that the float type of PHP is somewhat inaccurate. For high-precision mathematical computing, you can use the dedicated mathematical functions arbitraryprecisionmathfunctions series and gmp series
When using the float type of PHP, you must note that the float type of PHP is somewhat inaccurate. For high-precision mathematical computing, you can use the dedicated mathematical functions arbitraryprecisionmathfunctions series and gmp series
1. Float Type Definition
The float keyword indicates a simple type for storing 32-bit floating point values, as shown in Table 4-5.
Table 4-5 Float Type
Type
Fan Wei
Big and small
Type
Float
± 1. 5 × 10-45
In the project, the float type is used to define some columns, such as price, but many problems are found.
1. When the number of bits on the value is greater than 6, the float type is converted to the varchar type, which is displayed in the
Recently, in the process of doing the project, I stumbled across a problem, that is, the conversion of string and floating-point types. In the past, it was through [NSString stringwithformat:@ "%d", Goodcount] this way, and didn't care too much.
The representation of a float type can have several of the following:
Copy Code code as follows:
$a = 1.234;
$b = 1.2e3;
$c = 7E-10;
?>
What you need to be aware of with PHP's float type is that there is a problem with the accuracy
Think a lot of friends are not how to use the float type in MySQL, especially when it comes to money we may use double precision, we know that the type of float of MySQL is single precision floating point type is careless will cause data
JS in the decimal point after the two-bit method is the most commonly used is the rounding function, before I introduced the JS rounding a common function, here just use, below we take a float type decimal point after two some methods summary http://
Usage of float type in mysql bitsCN.com
A single-precision floating point uses 4-byte (32bit) to represent a floating point.A computer floating point number that adopts the IEEE754 standard is represented in binary format internally.For example, 7.22
When using QT Creator for programming, it is inevitable that all of my methods will be used to convert the float type to the qstring type:
1. Converting the qstring type to the float type is very simple.
Qstring data; float num = data. tofloat ();
Float types can be represented in the following types:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 PHP 2 $ = 1.234 ; 3 $ B = 1.2e3 ; 4 $ C = 7
Questions raised: 12.0f-11.9f=0.10000038, "Lose The Endless" why?Now let's analyze in detail why a floating point operation causes loss of precision.1, Decimal binary representation problemFirst of all, we need to figure out the following two
C # Operations SQL float type, the data will be many decimals, originally C # Float and SQL float type inconsistent. The following is a comparison of data types in the database and in C #. /// ///Comparison of data types in the
Below we will introduce how JavaScript preserves two decimal places:RoundedThe following processing results are rounded:var num =2.446242342// output result is 2.45Not roundedThe following processing results are not rounded:First, put the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.